<!doctype html>
<html>
<head>
    <meta charset=utf-8>
    <title></title>
    <meta name="robots" content="noindex,nofollow">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="<?=Web_Path?>packs/layui/css/layui.css">
    <link rel="stylesheet" href="<?=Web_Path?>packs/admin/css/font.css">
    <link rel="stylesheet" href="<?=Web_Path?>packs/admin/css/style.css">
    <?=$opt_gc?>
    <script src="<?=Web_Path?>packs/js/jquery.min.js"></script>
    <script src="<?=Web_Path?>packs/admin/js/setcolor.js"></script>
    <script src="<?=Web_Path?>packs/layui/layui.js"></script>
    <script src="<?=Web_Path?>packs/admin/js/cscms.js"></script>
</head>
<body id="index_setting">
    <span class="layui-breadcrumb" >
        <a ><cite><i class="fa fa-map-marker"></i>位置</cite></a>
        <a href="<?=site_url('pic/admin/pic')?>">图片</a>
        <a href="<?=site_url('pic/admin/pic')?>">图片管理</a>
        <a href=""><?=$title2?></a>
    </span>
    <div class="layui-tab layui-tab-brief" >
        <ul class="layui-tab-title">
            <li><a class="tablink" href="<?=site_url('pic/admin/pic')?>">图片列表</a></li>
            <li ><a class="tablink" href="<?=site_url('pic/admin/pic')?>?yid=2">待审核图片</a></li>
            <li ><a class="tablink" href="<?=site_url('pic/admin/pic')?>?yid=3">回收站图片</a></li>
            <li class="layui-this"><a class="tablink" href="<?=site_url('pic/admin/pic/edit')?>?id=<?=$id?>"><?=$title2?></a></li>
        </ul>
        <div class="layui-tab-content" style="min-height: 360px;">
            <form class="layui-form layui-form-pane" action="<?=site_url('pic/admin/pic/save')?>" method="post">
                <div class="layui-form-item">
                    <label class="layui-form-label">所属相册</label>
                    <div class="layui-input-inline layui-input-inlinew3">
                        <input id="sid" name="sid" type="hidden" value="<?=$sid?>">
                        <input type="text" id="name" name="name" onclick="cscms.get_open('<?=site_url('pic/admin/pic/res/'.$sid)?>','选择相册','500px','400px');" style="cursor: pointer;" value="<?=($sid>0)?getzd('pic_type','name',$sid):''?>" class="layui-input">
                    </div>
                    <div class="layui-input-inline layui-input-inlinew">
                        <select name="cid">
                            <option value="0">选择分类</option>
                            <?php
                            $query = $this->db->query("SELECT id,name FROM ".CS_SqlPrefix."pic_list where fid=0 order by xid asc"); 
                            foreach ($query->result() as $row) {
                                $clas=($row->id==$cid)?' selected="selected"':'';
                                echo '<option value="'.$row->id.'"'.$clas.'>'.$row->name.'</option>';
                                $query2 = $this->db->query("SELECT id,name FROM ".CS_SqlPrefix."pic_list where fid=".$row->id." order by xid asc"); 
                                foreach ($query2->result() as $row2) {
                                    $clas2=($row2->id==$cid)?' selected="selected"':'';
                                    echo '<option value="'.$row2->id.'"'.$clas2.'>'.$row2->name.'</option>';
                                }
                            }
                            ?>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <input type="checkbox" name="addtime" lay-skin="primary" value="ok" title="更新时间" checked>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">图片地址</label>
                    <div class="layui-input-inline" >
                        <input id="pic" type="text" name="pic" value="<?=$pic?>" class="layui-input">
                    </div>
                    <?php 
                        if(preg_match("/(iPhone|iPad|iPod|Android)/i", strtoupper($_SERVER['HTTP_USER_AGENT']))){
                            echo '<button type="button" class="layui-btn layui-btn-primary" id="pics"><i class="layui-icon colorb">&#xe608;</i>上传图片</button>';
                        }else{
                            echo '<div class="layui-input-inline" style="width: auto;"><a href="javascript:cscms.get_open(\''.site_url('upload/up').'?dir=pic\',\'上传图片\',\'500px\',\'360px\')" class="layui-btn layui-btn-primary"><i class="layui-icon" style="color:green">&#xe608;</i>上传图片</a></div>';
                        }
                    ?>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">所属会员</label>
                    <div class="layui-input-inline">
                        <input type="text" name="user" placeholder="站内注册的会员账号" value="<?=$user?>" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text" >
                    <label class="layui-form-label">图片内容</label>
                    <div class="layui-input-block">
                        <textarea id="text" lay-verify="content" name="content" placeholder="" class="layui-textarea"><?=$content?></textarea>
                    </div>
                </div>
                <?=$opt_field?>
                <input type="hidden" name="id" value="<?=$id?>">
                <input type="hidden" name="yid" value="<?=$yid?>">
                <div class="layui-form-item">
                    <div class="layui-input-block layui-input-common noborder">
                        <button class="layui-btn" lay-submit lay-filter="setting">提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <script type="text/javascript">
        cscms.init(5);
        cscms.mode('cscms.getUpload(\'<?=Web_Path.SELF?>/upload/up_save_json?dir=pic\')');
    </script>
</body>
</html>